

/// orgId : ""
/// returnCode : 0
/// orgInfo : {"orgNum":"1","orgName":"福建省厦门市鹭江公证处","latitudeAndLongitude":"118.19198,24.4966","orgFaxNum":"0592-5839568","orgZipCode":null,"orgAddress":"厦门市后埭溪路28号皇达大厦16层厦门市后埭溪路28号皇达大厦16层","orgWebsite":"218.98.113.88:42096","onlineCertUrl":"https://xmlj.egongzheng.com","orgId":"","orgPhone":"0592-5185177","levelOrder":1}
/// realnameStatus : "9"
/// accountType : "0"
/// mobile : "13400615954"
/// message : "登录成功！"
/// userId : ""
/// token : ""
/// realName : "程"
/// userAccount : ""
/// userType : "2"

///实体model：用户登录后的信息
class UserModel {
  String? userIdType;
  String? _orgId;
  String? isDisable;
  int? returnCode;
  int? userLevel;
  String? accountType;
  String? mobile;

  String? message;
  String? userId;
  String? token;
  String? realName;
  String? notaryName;
  String? userAccount;
  String? userType;
  String? isProfessionalUser;
  String? notaryId;
  OrgInfo? orgInfo;

  ///orgId为空则从对象orgInfo获取
  String? get orgId => _orgId?? orgInfo?.orgId;
  setOrgId(String? id){_orgId = id;}


  UserModel(
      {
      this.userIdType,
      String? orgId,
      this.isDisable,
      this.returnCode,
      this.userLevel,
      this.orgInfo,
      this.accountType,
      this.mobile,
      this.message,
      this.userId,
      this.token,
      this.realName,
      this.notaryName,
      this.userAccount,
      this.userType,
      this.isProfessionalUser,
      this.notaryId}) {
    _orgId = orgId;
  }

  UserModel.fromJson(dynamic json) {
    userIdType = json["userIdType"];
    _orgId = json["orgId"];
    isDisable = json["isDisable"];
    returnCode = json["returnCode"];
    userLevel = json["userLevel"];
    orgInfo =
        json["orgInfo"] != null ? OrgInfo.fromJson(json["orgInfo"]) : null;
    accountType = json["accountType"];
    mobile = json["mobile"];
    message = json["message"];
    userId = json["userId"];
    token = json["token"];
    realName = json["realName"];
    notaryName = json["notaryName"];
    userAccount = json["userAccount"];
    userType = json["userType"];
    isProfessionalUser = json["isProfessionalUser"];
    notaryId = json["notaryId"];
  }

  Map<String, dynamic> toJson() {
    var map = <String, dynamic>{};
    map["userIdType"] = userIdType;
    map["orgId"] = _orgId;
    map["isDisable"] = isDisable;
    map["returnCode"] = returnCode;
    map["userLevel"] = userLevel;
    if (orgInfo != null) {
      map["orgInfo"] = orgInfo?.toJson();
    }
    map["accountType"] = accountType;
    map["mobile"] = mobile;
    map["message"] = message;
    map["userId"] = userId;
    map["token"] = token;
    map["realName"] = realName;
    map["notaryName"] = notaryName;
    map["userAccount"] = userAccount;
    map["userType"] = userType;
    map["isProfessionalUser"] = isProfessionalUser;
    map["notaryId"] = notaryId;
    return map;
  }
}


/// orgNum : "1"
/// orgName : "福建省厦门市鹭江公证处"
/// orgFaxNum : "0592-******"
/// orgZipCode : null
/// orgId : ""
/// orgPhone : "0592-*******"
/// levelOrder : 1

class OrgInfo {
  String? orgNum;
  String? orgName;
  String? latitudeAndLongitude;
  String? orgFaxNum;
  String? orgZipCode;
  String? orgAddress;
  String? orgWebsite;
  String? onlineCertUrl;
  String? orgId;
  String? orgPhone;
  int? levelOrder;
  ///自定义参数，用于存放orgName转为的拼音、拼音首字母
  String? letterOfOrgName;
  String? firstLetter;

  OrgInfo(
      {this.orgNum,
      this.orgName,
      this.latitudeAndLongitude,
      this.orgFaxNum,
      this.orgZipCode,
      this.orgAddress,
      this.orgWebsite,
      this.onlineCertUrl,
      this.orgId,
      this.orgPhone,
      this.levelOrder});

  ///公证处信息json转对象
  ///hasLetter是否需要拼音字母，默认false
  OrgInfo.fromJson(dynamic json,{bool hasLetter = false}) {
    orgNum = json["orgNum"];
    orgName = json["orgName"];
    latitudeAndLongitude = json["latitudeAndLongitude"];
    orgFaxNum = json["orgFaxNum"];
    orgZipCode = json["orgZipCode"];
    orgAddress = json["orgAddress"];
    orgWebsite = json["orgWebsite"];
    onlineCertUrl = json["onlineCertUrl"];
    orgId = json["orgId"];
    orgPhone = json["orgPhone"];
    levelOrder = json["levelOrder"];
  }

  Map<String, dynamic> toJson() {
    var map = <String, dynamic>{};
    map["orgNum"] = orgNum;
    map["orgName"] = orgName;
    map["latitudeAndLongitude"] = latitudeAndLongitude;
    map["orgFaxNum"] = orgFaxNum;
    map["orgZipCode"] = orgZipCode;
    map["orgAddress"] = orgAddress;
    map["orgWebsite"] = orgWebsite;
    map["onlineCertUrl"] = onlineCertUrl;
    map["orgId"] = orgId;
    map["orgPhone"] = orgPhone;
    map["levelOrder"] = levelOrder;
    return map;
  }
}
